Soru & Cevap

Android read sms hata.

21.12.2015 - 12:07

Merhaba arkadaşlar.Android telefonda varolan smsleri uygulamama almak istiyorum fakat cursor bölümünde sıkıntı var diyor.
Andorid manifestimde şu izinler var.Hata logunu ekledim.İnternetteki tüm farklı cursor uri sekillerini dedim hep aynı hata.

Uri urisms = Uri.parse("content://sms/inbox");
       Cursor c = getContentResolver().query(urisms, null, null, null, null);
<uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="com.android.providers.telephony.SmsProvider" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
12-20 21:45:49.527 7906-7906/com.example.oguz.smsbackup E/AndroidRuntime: FATAL EXCEPTION: main
                                                                          Process: com.example.oguz.smsbackup, PID: 7906
                                                                          java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.oguz.smsbackup/com.example.oguz.smsbackup.listview1}: java.lang.SecurityException: Permission Denial: reading com.android.providers.telephony.SmsProvider uri content://sms/sent from pid=7906, uid=10057 requires android.permission.READ_SMS, or grantUriPermission()
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                              at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                              at android.os.Looper.loop(Looper.java:148)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                           Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.telephony.SmsProvider uri content://sms/sent from pid=7906, uid=10057 requires android.permission.READ_SMS, or grantUriPermission()
                                                                              at android.os.Parcel.readException(Parcel.java:1599)
                                                                              at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
                                                                              at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
                                                                              at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
                                                                              at android.content.ContentResolver.query(ContentResolver.java:491)
                                                                              at android.content.ContentResolver.query(ContentResolver.java:434)
                                                                              at com.example.oguz.smsbackup.listview1.onCreate(listview1.java:31)
                                                                              at android.app.Activity.performCreate(Activity.java:6237)
                                                                              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                              at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                              at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                              at android.os.Looper.loop(Looper.java:148) 
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                              at java.lang.reflect.Method.invoke(Native Method) 
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

 

15 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

picture-1372-1408467635.jpg
ahmtbrk
10.05.2016 - 05:03

Android 6.0 sürümünde izin modeli değişti çalışma zamanlı izin almanız gerekiyor sms'leri okuyabilmek için.

http://stackoverflow.com/a/32846384

Buradan devam edebilirsiniz.